package ro.upt.dcda.web.admin;

import java.util.List;
import java.util.Map;

import ro.upt.dcda.pricezone.common.Config;
import ro.upt.dcda.pricezone.common.Config.ServerInfo;
import ro.upt.dcda.pricezone.s1.pojo.Admin;

import com.opensymphony.xwork2.ActionContext;

public class AdminConfigServlet {

	private List<ServerInfo> servers;

	public String execute() throws Exception {
		System.out.println("Viewing servers config");
		Map<String, Object> session = ActionContext.getContext().getSession();
		Admin admin = (Admin) session.get("admin");
		String adminSid = (String) session.get("adminSid");
		if (admin == null || adminSid == null) {
			return "noAuth";
		}
		servers = Config.getServerList();
		return "def";
	}

	public List<ServerInfo> getServers() {
		return servers;
	}

	public void setServers(List<ServerInfo> servers) {
		this.servers = servers;
	}
}
